﻿<UserControl x:Class="Quizio.Views.HomeViews.GameResult"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="700"
             DataContext="{Binding GameHistoryViewModel}">
    
    <Grid Style="{StaticResource ContentRoot}">
        <Grid.RowDefinitions>
            <RowDefinition Height="400"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="0" Grid.Row="0" Text="Deine gespielten Quiz im Multiplayer Modus" Style="{StaticResource Heading2}" />
        <ScrollViewer Grid.Column="0" Grid.Row="0" MaxHeight="360" Margin="0,40,0,0">
            <StackPanel MinWidth="200">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="120"></ColumnDefinition>
                        <ColumnDefinition Width="120"></ColumnDefinition>
                        <ColumnDefinition Width="120"></ColumnDefinition>
                        <ColumnDefinition Width="150"></ColumnDefinition>
                        <ColumnDefinition Width="120"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0" Grid.Column="0" Content="Herausforderer" HorizontalAlignment="Center"/>
                    <Label Grid.Row="0" Grid.Column="1" Content="Gegen" HorizontalAlignment="Center"/>
                    <Label Grid.Row="0" Grid.Column="2" Content="Kategorie" HorizontalAlignment="Center"/>
                    <Label Grid.Row="0" Grid.Column="3" Content="Quiz" HorizontalAlignment="Center"/>
                    <Label Grid.Row="0" Grid.Column="4" Content="Status" HorizontalAlignment="Center"/>
                </Grid>
                <ListBox x:Name="playedGames"  ItemsSource="{Binding Aggregator.Challenges}" Width="650" Margin="0,20"
                         SelectedItem="{Binding SelectedChallenge}"  HorizontalAlignment="Left">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="120"></ColumnDefinition>
                                    <ColumnDefinition Width="120"></ColumnDefinition>
                                    <ColumnDefinition Width="120"></ColumnDefinition>
                                    <ColumnDefinition Width="150"></ColumnDefinition>
                                    <ColumnDefinition Width="120"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding ChallengeGame.Player.Name}" HorizontalAlignment="Center"/>
                                <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding ChallengedPlayer.Name}" HorizontalAlignment="Center"/>
                                <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding ChallengeGame.Category.Name}" HorizontalAlignment="Center"/>
                                <TextBlock Grid.Row="0" Grid.Column="3" Text="{Binding ChallengeGame.PlayedQuiz.Title}" HorizontalAlignment="Center"/>
                                <TextBlock Grid.Row="0" Grid.Column="4" Text="{Binding Status}" HorizontalAlignment="Center"/>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </ScrollViewer>
        <mui:ModernButton Content="Resultate ansehen" EllipseDiameter="40" EllipseStrokeThickness="1" IconWidth="23" IconHeight="23" HorizontalAlignment="Right"
                          Command="{Binding ShowChallengeResults}" Grid.Column="0" Grid.Row="1"
                          IconData="F1 M 44.3333,19L 57,19L 57,31.6667L 52.25,36.4167L 52.25,27.7083L 34.8333,45.125L 30.875,41.1667L 48.2917,23.75L 39.5833,23.75L 44.3333,19 Z M 19,25.3333L 42.75,25.3333L 38,30.0833L 23.75,30.0833L 23.75,52.25L 45.9167,52.25L 45.9167,38L 50.6667,33.25L 50.6667,57L 19,57L 19,25.3333 Z">
        </mui:ModernButton>
        <mui:ModernProgressRing Width="50" Height="50" IsEnabled="True" IsActive="{Binding ShowOrHide}" VerticalAlignment="Bottom" HorizontalAlignment="Center">
        </mui:ModernProgressRing>
    </Grid>
</UserControl>
